package org.amse.tanks.objects;

import org.amse.tanks.model.ModelConstants;

import java.io.Serializable;

public class Tank implements ModelConstants, Serializable {
    private Direction myDirection;
    private int myX;    //left top cell
    private int myY;    //
    private int myId;
    private static int myIdCounter = TANK_INITIAL_ID_COUNTER;

    private boolean rateOfFireBonusTaken;
    private boolean speedBonusTaken;
    private boolean piercingBonusTaken;

    private int movingAbilityCounter;
    private int shotsInabilityCounter;
    private Direction nextDirection;
    private boolean shotMade;
    private int slidingCounter;
    private boolean isSliding;

    public Tank() {
        myDirection = Direction.UP;
        myX = 0;
        myY = 0;
        myId = myIdCounter++;

        rateOfFireBonusTaken = false;
        speedBonusTaken = false;
        piercingBonusTaken = false;

        movingAbilityCounter = 0;
        shotsInabilityCounter = 0;
        nextDirection = Direction.UP;
        shotMade = false;
        slidingCounter = 0;
        isSliding = true;
    }

    public boolean isSliding() {
        return isSliding;
    }

    public void setSliding(boolean sliding) {
        isSliding = sliding;
    }

    public int getSlidingCounter() {
        return slidingCounter;
    }

    public void setSlidingCounter(int slidingCounter) {
        this.slidingCounter = slidingCounter;
    }

    public boolean isShotMade() {
        return shotMade;
    }

    public void setShotMade(boolean shotMade) {
        this.shotMade = shotMade;
    }

    public int getMovingAbilityCounter() {
        return movingAbilityCounter;
    }

    public void setMovingAbilityCounter(int movingAbilityCounter) {
        this.movingAbilityCounter = movingAbilityCounter;
    }

    public int getShotsInabilityCounter() {
        return shotsInabilityCounter;
    }

    public void setShotsInabilityCounter(int shotsInabilityCounter) {
        this.shotsInabilityCounter = shotsInabilityCounter;
    }

    public Direction getNextDirection() {
        return nextDirection;
    }

    public void setNextDirection(Direction nextDirection) {
        this.nextDirection = nextDirection;
    }

    public boolean isRateOfFireBonusTaken(){
        return rateOfFireBonusTaken;
    }

    public boolean isSpeedBonusTaken(){
        return speedBonusTaken;
    }

    public boolean isPiercingBonusTaken(){
        return piercingBonusTaken;
    }

    public void setRateOfFireBonusTaken(boolean value) {
        rateOfFireBonusTaken = value;
    }

    public void setSpeedBonusTaken(boolean value) {
        speedBonusTaken = value;
    }

    public void setPiercingBonusTaken(boolean value) {
        piercingBonusTaken = value;
    }

    public void setDirection(Direction direction) {
        myDirection = direction;
    }

    public void setX(int x) {
        myX = x;
    }

    public void setY(int y) {
        myY = y;
    }

    public Direction getDirection() {
        return myDirection;
    }

    public int getX() {
        return myX;
    }

    public int getY() {
        return myY;
    }

    public int getId() {
        return myId;
    }

    public void moveUp() {
        myDirection = Direction.UP;
        myY--;
    }

    public void moveDown() {
        myDirection = Direction.DOWN;
        myY++;
    }

    public void moveLeft() {
        myDirection = Direction.LEFT;
        myX--;
    }

    public void moveRight() {
        myDirection = Direction.RIGHT;
        myX++;
    }
}